#pragma once

#include "HotKey.h"

class HotKeyManager
  {
  public:
    typedef std::vector<boost::shared_ptr<HotKey> > HotKeyContainer;
    typedef HotKeyContainer::iterator HotKeyIterator;
  
    static HotKeyManager& GetInstance();
  
    // Interface
    bool AddHotKey(HotKey::KeyCode i_vk_code, 
      HotKeyOperation::IOperation * p_operation = 0,
      const std::wstring& i_name = std::wstring(),
      HotKey::Modifier i_modifier = MOD_NONE);
    HotKeyIterator GetHotKey(unsigned int i_id);
    HotKeyIterator GetHotKey(HotKey::KeyCode i_vk_code, HotKey::Modifier i_modifier);
    HotKeyIterator GetHotKey(std::wstring& i_name);    
    bool RemoveHotKey(HotKeyIterator it_hot_key);
    bool RemoveHotKey(HotKey::KeyCode i_vk_code, HotKey::Modifier i_modifier);
    bool RemoveHotKey(std::wstring& i_name);
    void Clear();
    bool Contains(HotKey::KeyCode i_vk_code, HotKey::Modifier i_modifier);
    size_t GetNumberOfRegistered() const;

    void Save(std::wstring i_filename);
    void Load(std::wstring i_filename);

    // Iterators
    HotKeyIterator GetBegin();
    HotKeyIterator GetEnd();

  private:
    HotKeyManager(void);
    ~HotKeyManager(void);

    HotKeyContainer m_hot_keys;
    int m_next_id;
  };


